package com.slf.spring.security.utils;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;

/**
 * @author slf
 * @date 2021/7/12
 */
public class FileUtil {
    private static void writeFile(String path ,String fileName,byte[] bytes) throws Exception {
        File file =new File(path +fileName);
        if(!file.exists()){
            file.createNewFile();
        }
        Files.write(file.toPath(), bytes);
    }

    private static void writeFile(String destPath, byte[] bytes) throws IOException {
        File dest = new File(destPath);
        if (!dest.exists()) {
            dest.createNewFile();
        }
        Files.write(dest.toPath(), bytes);
    }
}
